package vn.bus.models;

import java.sql.Connection;
import java.util.ArrayList;

import vn.bus.dao.Database;
import vn.bus.dao.NearbyConnectionDAO;
import vn.bus.dto.NearbyConnectionDTO;;

public class NearbyConnectionManager {

	public ArrayList<NearbyConnectionDTO> getAllNearbyConns()throws Exception {
		ArrayList<NearbyConnectionDTO> allNearbyConns = null;
		try {
			    Database database= new Database();
			    Connection connection = database.Get_Connection();
			    NearbyConnectionDAO NearbyConn = new NearbyConnectionDAO();
			    allNearbyConns = NearbyConn.getAllNearbyConnections(connection);
			    connection.close();
		
		} catch (Exception e) {
			throw e;
		}
		return allNearbyConns;
	}
	
	public String updatePolyline(String polyline, String station, String nearby)throws Exception {
		String rs = "";
		try {
			    Database database= new Database();
			    Connection connection = database.Get_Connection();
			    NearbyConnectionDAO NearbyConn = new NearbyConnectionDAO();
			    rs = NearbyConn.updatePolyline(connection, polyline, station, nearby);
			    connection.close();
		
		} catch (Exception e) {
			throw e;
		}
		return rs;
	}//updatePolyline
}
